<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />     
		<title>在页面上使用google地图示例</title>
		<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>  
		<script type="text/javascript">
			function init(){
				navigator.geolocation.getCurrentPosition(function(position){
					var coords = position.coords;
					var latlng = new google.maps.LatLng(coords.latitude,coords.longitude);
					var myOptions = {
						zoom:14,
						center:latlng,
						mapTypeId:google.maps.MapTypeId.ROADMAP
					};
					var map1;
					map1 = new google.maps.Map(document.getElementById("map"),myOptions);
					var marker = new google.maps.InfoWindow({
						position:latlng,
						map:map1
					});
					var infowindow = new google.maps.InfoWindow({
						content:"当前位置"
					});
					infowindow.open(map1,marker);
				});
			}
		</script>
	</head>
	<body onload="init()">
		<div id="map" style="width: 400px;height: 400px;"></div>
	</body>
</html>
